package com.taotao.designpattern.chain;

import java.util.LinkedList;

/**
 * 责任链模式
 *
 * @author fanbeibei
 * @version 1.0
 * @date 2021/1/5 10:40
 */
public class ChainServer {

    private LinkedList<Handler> handlers = new LinkedList<>();

    public void addLast(Handler handler) {
        handlers.addLast(handler);
    }


    public Response onRequest(Request request) {
        ChainContext context = new ChainContext(handlers);
        return context.fireHandleRequest(request);
    }

}
